class Bullet extends imageClass{
    constructor(game){
        super(game, "bullet")
        this.setup()
    }
    setup(){
        this.speed = config.bullet_speed
    }
    update (){
        if (this.y >= -this.h-50){
            this.y -= this.speed
        }else{
            this.scene.bullet.remove(this)
        }
    }
}

/*
var Bullet = function(game){
    var o = game.imgByName("bullet")
    o.speedY = -10

    o.fired = false
    o.fire = function(){
        o.fired = true
    }
    o.reboundFrom = function(it){
        var hasCollide = false

        o.speedY = -o.speedY
        o.x += o.speedX
        o.y += o.speedY
        hasCollide = collide(o, it)
        o.x -= o.speedX
        o.y -= o.speedY
        if (hasCollide){
            o.speedY = -o.speedY
            o.speedX = -o.speedX
        }
    }
    o.move = function(){
        if (o.fired){
            o.y += o.speedY
        }
    }
    o.clickd = function(mouseX, mouseY){
        if (o.x <= mouseX && mouseX <= o.x + o.img.width 
             && o.y <= mouseY && mouseY <= o.y + o.img.height){
            return true
        }
        return false
    }

    return o
}
*/